#pragma once

#include <d3dx10.h>
#include "GUIComponent.h"

#pragma comment(linker, "/INCLUDE:??0FPSComponent@@QAE@XZ")

class FPSComponent : public GUIComponent
{
public:
	FPSComponent(void);
	~FPSComponent(void);

	HRESULT LoadGraphicsContent(EnginePointer<ID3D10Device> &pDevice);
	void UnloadGraphicsContent();
	void Update(LONGLONG timeElapsed);
	void Draw();

	void Serialize(EnginePointer<ISerializerWriteContext>& context, char* name);
	static IEngineComponent* Deserialize(EnginePointer<ISerializerReadContext>& context);

	AUTO_SIZE;

	static int test;
private:
	EnginePointer<ID3D10Device> pDevice;
	ID3DX10Font* pFont;
	unsigned int updateInterval;
	LONGLONG* updateTimes;
	unsigned int index;
	double fps;
};
